package com.example.Flyweight;

import java.util.HashMap;
import java.util.Map;

public class ShapeFactory {
    static Map<String, Shape> map = new HashMap<>();

    public static Shape getCircle(String color) {
        Shape shape = map.get(color);
        if (null == shape) {
            System.out.println("Create circle: " + color);
            shape = new Circle(color);
            map.put(color, shape);
        }
        return shape;
    }
}
